package com.zjitc.controller;

import com.zjitc.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/3/19 16:41
 * @description:
 */
@Controller
public class ParamController {

    @RequestMapping("/param")
    @ResponseBody
    public String param1(
      @RequestParam(name = "id" , required = false , defaultValue = "23" ) Integer id, String name){
      return "id = " + id + "\tname = " + name;
      }

      @RequestMapping("/object")
      @ResponseBody
      public String param2(User user){
        return user.toString();
      }
}
